<template>
  <div>
    <el-container style="height: 100vh; border: 1px solid #eee">
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu :default-openeds="menuIndex" router unique-opened :default-active="$route.path">
          <el-submenu index="1">
            <template slot="title">内容管理</template>
            <el-menu-item-group>
              <template slot="title">广告</template>
              <el-menu-item index="/ads/list">广告列表</el-menu-item>
              <el-menu-item index="/ads/create">新建广告</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">商品管理</template>
            <el-menu-item-group>
              <template slot="title">分类</template>
              <el-menu-item index="/category/list">商品分类</el-menu-item>
              <el-menu-item index="/category/create">新建分类</el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group>
              <template slot="title">商品</template>
              <el-menu-item index="/goods/list">商品列表</el-menu-item>
              <el-menu-item index="/goods/create">新建商品</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">订单管理</template>
            <el-menu-item-group>
              <template slot="title">订单</template>
              <el-menu-item index="/order/list">订单列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">用户管理</template>
            <el-menu-item-group>
              <template slot="title">用户</template>
              <el-menu-item index="/user/list">用户列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="5">
            <template slot="title">系统设置</template>
            <el-menu-item-group>
              <template slot="title">管理员</template>
              <el-menu-item index="/admin_users/list">管理员列表</el-menu-item>
              <el-menu-item index="/admin_users/create">新建管理员</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header style="text-align: right; font-size: 12px">
          <el-dropdown>
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>查看</el-dropdown-item>
              <el-dropdown-item>新增</el-dropdown-item>
              <el-dropdown-item>删除</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <span>王小虎</span>
        </el-header>
        <el-main>
          <router-view :key="$route.path"></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menuIndex: []
    };
  },
  methods: {}
};
</script>

<style>
html,
body {
  margin: 0;
  padding: 0;
}
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>